﻿@if ((Model != null) && (Model is SalesPortal.Web.Models.IPaginator))
{
<nav class="navbar navbar-inverse navbar-default">
    <div class="container-fluid">
        <!-- Collect the nav links, forms, and other content for toggling -->
        <div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
            <ul class="nav navbar-nav">

                @if (Model.TablePager.PrevPageNo > 0)
                {
                <li>
                    <a href="@Url.Action("Index", new { p = Model.TablePager.PrevPageNo })"><span class="glyphicon glyphicon-chevron-left" aria-hidden="true"></span> PREV </a>
                </li>
                }
                else
                {
                <li>
                    <a class="disabled"><span class="glyphicon glyphicon-chevron-left" aria-hidden="true"></span> PREV <span class="sr-only">(current)</span></a>
                </li>
                }

                @if (Model.TablePager.NextPageNo < Model.TablePager.TotalNumberOfPages)
                {
                <li>
                    <a href="@Url.Action("Index", new { p = Model.TablePager.NextPageNo })"> NEXT <span class="glyphicon glyphicon-chevron-right" aria-hidden="true"></span></a>
                </li>
                }
                else
                {
                <li>
                    <a class="disabled"> NEXT <span class="glyphicon glyphicon-chevron-right" aria-hidden="true"></span></a>
                </li>
                }

                <li>
                    <p>&nbsp;&nbsp;&nbsp;&nbsp;</p>
                </li>

                @*<li class="active"><a href="#">01</a></li>
                <li><a href="#">02</a></li>
                <li><a href="#">03</a></li>
                <li><a href="#">04</a></li>
                <li><a href="#">05</a></li>*@

                @foreach (int num in Model.TablePager.RelatedPages)
                {
                    if (num == Model.TablePager.CurrentPageNo)
                    {
                    <li class="active"><a>@num.ToString("00")</a></li>
                    }
                    else
                    {
                    @*<li><a href="@Url.Action("Index", new { p = @num })">@num.ToString("00")</a></li>*@
                    <li>
                        <a style="cursor:pointer;" onclick="goToPage(@num)">@num.ToString("00")</a>
                    </li>
                    }
                }

                <li class="dropdown">
                    <a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">Page Size <span class="caret"></span></a>
                    <ul class="dropdown-menu">
                        <li><a href="#">10 records per page</a></li>
                        <li class="active"><a href="#">25 records per page</a></li>
                        <li><a href="#">50 records per page</a></li>
                    </ul>
                </li>
            </ul>

            <ul class="nav navbar-nav navbar-right">
                <li>
                    <button type="button" class="btn btn-primary navbar-btn btn-link" data-toggle="modal" data-target="#filterRecordsModal">
                        <span class="glyphicon glyphicon-filter"></span> filter records
                    </button>
                </li>
            </ul>
            @*<form class="navbar-form navbar-right" role="search">
                <div class="form-group">
                    <input type="text" class="form-control page-input" placeholder="page#">
                </div>
                <button type="submit" class="btn btn-primary navbar-form-btn btn-xs"><span class="glyphicon glyphicon-search" aria-hidden="true"></span>  Go</button>
            </form>*@

            @using (Html.BeginForm("Index", "Employee", FormMethod.Post, new { @class = "navbar-form navbar-right", role = "search", id="pagejump_form" }))
            {
                <div class="form-group">
                    @*<input type="text" class="form-control page-input" placeholder="page#">*@
                    @Html.TextBox("p", string.Empty, new { @class = "form-control page-input text-center", placeholder="page#", id="pageNo" })
                </div>
                
                <button type="submit" class="btn btn-primary navbar-form-btn btn-xs"><span class="glyphicon glyphicon-search" aria-hidden="true"></span> Go </button>
            }
        </div><!-- /.navbar-collapse -->
    </div><!-- /.container-fluid -->
</nav>
}
else
{
<p>no page</p>
}